<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>保险公司 管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<form id="insCompInfo_form">
    <div class="fieldset1 tabel_col tabel_col_1 clearFix">
        <div class="fieldBox col_50">
            <div class="label">公司名称</div>
            <div class="field">
                <input name="compNm" id="compNm" type="text" class="ui-textbox" value="${insCompInfoVO.compNm}"
                       validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_50">
            <div class="label">公司编号</div>
            <div class="field">
                <input name="compNo" id="compNo" type="text" class="ui-textbox" value="${insCompInfoVO.compNo}"
                       validate="{required:false}">
            </div>
        </div>
        <div class="fieldBox col_50">
            <div class="label">联系人</div>
            <div class="field">
                <input name="lmNm" id="lmNm" type="text" class="ui-textbox" value="${insCompInfoVO.lmNm}"
                       validate="{required:true,nmcharacter:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_50">
            <div class="label">联系电话</div>
            <div class="field">
                <input name="lmTel" id="lmTel" type="text" class="ui-textbox" value="${insCompInfoVO.lmTel}"
                       validate="{required:true,mobileAndFixedPhone:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_50">
            <div class="label">电子邮箱</div>
            <div class="field">
                <input name="lmEmail" id="lmEmail" type="text" class="ui-textbox" value="${insCompInfoVO.lmEmail}"
                       validate="{required:false,email:true}">
            </div>
        </div>
        <div class="fieldBox col_50">
            <div class="label">邮编</div>
            <div class="field">
                <input name="zipNo" id="zipNo" type="text" class="ui-textbox" value="${insCompInfoVO.zipNo}"
                       validate="{required:false,zipcode:true}">
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">公司地址</div>
            <div class="field">
                <textarea name="compAddr" id="compAddr" class="ui-textarea l-textarea" cols="86" rows="2"
                          value="${insCompInfoVO.compAddr}"
                          validate="{required:false}">${insCompInfoVO.compAddr}</textarea>
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">备注</div>
            <div class="field">
                <textarea name="compRem" id="compRem" class="ui-textarea l-textarea" cols="86" rows="3"
                          value="${insCompInfoVO.compRem}"
                          validate="{required:false}">${insCompInfoVO.compRem}</textarea>
            </div>
        </div>
    </div>
    <div class="btnsBox">
        <input name="compPid" id="compPid" type="text" style="display: none" value="0">
        <input name="compLvl" id="compLvl" type="text" style="display: none" value="1">
        <input name="compStsCd" id="compStsCd" type="text" style="display: none" value="10">
        <span id="saveInsCompInfo_Btn" class="sq-button sq-button-hasicon l-dialog-btn-ok">
        <i class="sqBtnIco_10"></i>保存</span>
        <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
    </div>
</form>
<script>
    $(function () {
        var insCompInfoId = "${insCompInfoVO.id}";//主键ID
        $("#insCompInfo_form").ligerForm({
            validate: true
        });
        /*保存*/
        $("#saveInsCompInfo_Btn").click(function (event) {
            var form = liger.get("insCompInfo_form");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var data = form.getData();
            $.ligerDialog.hide();
            var _url;
            if (insCompInfoId == '') {//新增
                _url = '<%=path%>/insurance/insCompInfo/add.do';
            } else {//修改
                _url = '<%=path%>/insurance/insCompInfo/modify.do?id=' + insCompInfoId;
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        parent.$("#clearBtn").click();
                        parent.$("#searchBtn").click();
                        frameElement.dialog.close();
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });
    });
</script>
</body>
</html>
